package com.ruoyi.web.controller.chargepile;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.chargepile.domain.ChargePile;
import com.ruoyi.chargepile.domain.Points;
import com.ruoyi.chargepile.mapper.PointsMapper;
import com.ruoyi.chargepile.service.PointsService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.util.DateRange;
import com.ruoyi.util.Pages;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.awt.*;
import java.util.List;

/**
 * <p>
 * 积分表 前端控制器
 * </p>
 *
 * @author zxc
 * @since 2024-07-03
 */
@RestController
@RequestMapping("/points")
public class PointsController {

    @Autowired
    private PointsService pointsService;

    @Resource
    private PointsMapper pointsMapper;

    @GetMapping("/getPoints")
    public AjaxResult getPoints() {
        Long userId = SecurityUtils.getLoginUser().getUserId();;
        QueryWrapper<Points> pointsQueryWrapper = new QueryWrapper<>();
        pointsQueryWrapper
                .lambda()
                .eq(Points::getUserId, userId);
        Points points = pointsMapper.selectOne(pointsQueryWrapper);
        return AjaxResult.success(points);
    }

}

